package approve.adapter;

import java.util.List;

import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;
import approve.action.R;
import approve.model.ListApprove;

public class ApproverMeetingPendingAdapter extends BaseAdapter{
	private Context context;
	private List<ListApprove> arrayLstApp;
	private Bundle language;
	LinearLayout flag = null;
	
	public ApproverMeetingPendingAdapter(Context context,List<ListApprove> arrayLstApp, Bundle language) {
		super();
		this.context = context;
		this.arrayLstApp = arrayLstApp;
		this.language = language;
	}

	@Override
	public int getCount() {
		return arrayLstApp.size();
	}

	@Override
	public Object getItem(int arg0) {
		return arrayLstApp.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(int position, View convertview, ViewGroup arg2) {
		ViewHolder holder = null;
		
		ListApprove app = arrayLstApp.get(position);
		
		if(convertview==null){
			holder = new ViewHolder();
			
			LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			convertview=inflater.inflate(R.layout.adapter_approver_meeting_viewform11, arg2,false);
			
			holder.lbName = (TextView)convertview.findViewById(R.id.lbEmployee11);
			holder.lbName.setText(language.getString("ac_ma_EmployeeName")+": ");
			holder.lbName.setTextColor(Color.YELLOW);
			holder.lbDept = (TextView)convertview.findViewById(R.id.lbDepartment11);
			holder.lbDept.setText(language.getString("ac_MNLDepartmentCode")+": ");
			holder.lbDept.setTextColor(Color.YELLOW);
			
			holder.valName = (TextView)convertview.findViewById(R.id.valEmployee11);
			holder.valDept = (TextView)convertview.findViewById(R.id.valDepartment11);
			
			convertview.setBackgroundResource(R.drawable.list_selector);
			
			convertview.setTag(holder);
			
		}else{
			holder = (ViewHolder)convertview.getTag();
		}
		
		
		holder.valName.setText(app.getEmname());
		holder.valDept.setText(app.getDepartmentname());
		
		return convertview;
	}
	public Context getContext() {
		return context;
	}

	public void setContext(Context context) {
		this.context = context;
	}

	public List<ListApprove> getArrayLstApp() {
		return arrayLstApp;
	}

	public void setArrayLstApp(List<ListApprove> arrayLstApp) {
		this.arrayLstApp = arrayLstApp;
	}

	public Bundle getLanguage() {
		return language;
	}

	public void setLanguage(Bundle language) {
		this.language = language;
	}

	public static class ViewHolder{
		TextView lbName,lbDept,valName,valDept;
	}
}
